<template lang="">
    <div>
        <top></top>
        <center></center>
        <foot :arr="arr"></foot>
        <page @changePage="changePage" :total="total" :page="page" :pageSize="pageSize"></page>
        
    </div>
</template>

<script>
import center from "./components/center.vue";
import top from "./components/top.vue";
import foot from "./components/foot.vue";
import { getUserData } from "../../api/userApi";
import page from "./components/page.vue";
export default {
  data() {
    return {
      arr: [],
      page: 1,
      total: 0,
      pageSize: 10
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      getUserData({ page: this.page, pageSize: this.pageSize }).then(res => {
        if (res.code == 200) {
          this.arr = res.data;
          this.total = res.total;
        }
      });
    },
    changePage(val) {
      this.page = val;
      this.getData()
      console.log(this.page);
    }
  },
  components: {
    center,
    top,
    foot,
    page
  }
};
</script>

<style lang="less" scoped>
</style>